#ifndef MOLECULAR_MOLECULAR_ATOM_H
#define MOLECULAR_MOLECULAR_ATOM_H

#include "molecular_basic_types.h"
#include "molecular_atom_end_point.h"

namespace M {
    class Core;

    class Atom
    {
        friend class Core;

    public:
        virtual ~Atom() {}

        virtual String name() const = 0;
        virtual bool OnExecute(const AtomEndPoint &oSrcAtom, int nFuncId, void *pParams, void *pIOParams) { return false; }
        virtual bool OnEvent(const AtomEndPoint &oSrcAtom, int nEventId, void *pParams) { return true; }

    protected:
        Core * GetCore();
        bool Execute(const String &strAtomId, int nFuncId, void *pParams, void *pIOParams);
        bool FireEvent(int nEventId, void *pParams);

    private:
        void Init(Core *pCore);
        void Uninit();

        Core *m_pCore;
    };
}

#endif  // MOLECULAR_MOLECULAR_ATOM_H